/*年轻人，只管向前看，不要管自暴自弃者的话*/

import 'package:flutter/cupertino.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';

import '../../res/style.dart';

///create by itz on 2024/1/5 9:34
///desc :

typedef void onClick();

class RowItemView extends StatelessWidget {
  RowItemView({
    super.key,
    required this.icon,
    required this.name,
    this.backIcon = "assets/images/ic_to_right.png",
    this.backVisible = true,
    this.onclick,
  });

  final String icon;
  final String name;
  final String backIcon;
  final bool backVisible;
  onClick? onclick;

  @override
  Widget build(BuildContext context) {
    return GestureDetector(
      onTap: () {
        if (onclick != null) onclick!();
      },
      child: Padding(
        padding: EdgeInsets.only(top: 12.h, bottom: 12.h),
        child: Flex(
          direction: Axis.horizontal,
          children: [
            Image(
              height: 32.h,
              width: 32.w,
              image: AssetImage(icon),
            ),
            Box.wBox18,
            Expanded(flex: 1, child: Text(name, style: Styles.style_FF333333_16_w500)),
            Visibility(
              visible: backVisible,
              child: Image(
                height: 13.h,
                width: 7.w,
                image: AssetImage(backIcon),
              ),
            )
          ],
        ),
      ),
    );
  }
}
